<template>
  <a-config-provider :locale="zhCN">
  <router-view/>
  </a-config-provider>
</template>
<script>
import zhCN from 'ant-design-vue/es/locale/zh_CN'
import { onMounted, getCurrentInstance } from 'vue'
import { getLocalStore } from '@/utils/local-storage'
import { useStore } from 'vuex'
export default {
  setup () {
    const store = useStore()
    const { proxy } = getCurrentInstance()
    onMounted(async () => {
      const userInfo = await getLocalStore('HM_CONFIG_USER_INFO')
      if (userInfo) {
        store.commit('SET_CURRENT_USER', userInfo)
      }
      const { data } = await proxy.$root.$axios.getProjetList()
      store.state.project = data
      store.state.projectIds = data.map(item => item.id)
      store.state.projectOptions = data.map(item => {
        return {
          value: item.id,
          title: item.name
        }
      })
    })
    return {
      zhCN
    }
  }
}
</script>
<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  min-width: 1000px;
}
</style>
